const path = require('path')
const HtmlWebpackPlugin = require('html-webpack-plugin')

const resolvePath = (pathStr) => path.resolve(__dirname, pathStr)

module.exports = {
  mode: 'production',
  entry: './src/index.js',
  output: {
    path: resolvePath('dist'),
    filename: 'main.js',
    clean: true
  },
  plugins: [
    new HtmlWebpackPlugin()
  ],
  module: {
    rules: [{
      test: /\.js$/,
      exclude: /node_modules/,
      use: [{
        loader: 'babel-loader',
        options: {
          presets: ["@babel/preset-env"]
        }
        // }, {
        //   loader: 'thread-loader',
        //   options: {
        //     workers: 4
        //   }
      }]
    }]
  }
}